<!doctype html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>学生界面</title>
<meta name="description" content="这是学生主页">
<meta name="keywords" content="index">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="../img/lysf.ico">
<link rel="stylesheet" href="../amazeui/css/amazeui.min.css" />
<link rel="stylesheet" href="css/admin.css">
<link rel="stylesheet" href="css/app.css">
</head>

<body style="margin-left: 10px;overflow:hidden;" >

	<div id="ref_page" class="am-g">
	
			<div class="tpl-content-page-title" style="margin-bottom: 10px;">填写免答辩申请表</div>

			<div class="am-panel am-panel-default">
				<div class="am-panel-bd">
					<div class="am-scrollable-horizontal">
							<table class="am-table am-table-bordered  am-table-centered am-text-nowrap">
								<thead>
									<tr>
										<th colspan="9">信息技术学院本科生毕业设计（论文）免答辩申请表</th>
									</tr>
								</thead>
								<tbody>
									<tr id="tr1">
										<td colspan="2">学 号</td>
										<td colspan="2"></td>
										<td>姓 名</td>
										<td colspan="2"></td>
										<td>性 别</td>
										<td></td>
									</tr>
									<tr id="tr2">
										<td colspan="2">专 业</td>
										<td colspan="3"></td>
										<td>年 级</td>
										<td></td>
										<td>班 级</td>
										<td></td>
									</tr>
									<tr id="tr3">
										<td colspan="2">申请人签名</td>
										<td colspan="3"></td>
										<td colspan="2">联系电话</td>
										<td colspan="2"></td>
									</tr>
									<tr id="tr4">
										<td colspan="2">论文题目</td>
										<td colspan="3"></td>
										<td colspan="2">导师姓名</td>
										<td colspan="2"></td>
									</tr>
									<tr style="height: 260px;">
										<td colspan="2" class="am-text-middle">申请理由</td>
										<td colspan="7"><textarea id="column1"
												style="width: 100%; height: 260px;"></textarea></td>
									</tr>
								</tbody>
							</table>
							<button id="mdb_btn" type="button" class="am-btn am-btn-primary am-radius am-fr"
								data-am-loading="{spinner: 'circle-o-notch', loadingText: '提交中...', resetText: '提交完成'}">
								提交</button>
					</div>
				</div>
			</div>
			  
	</div>
	
	<!-- 免答辩提示弹窗 -->
	<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	  <div class="am-modal-dialog">
	    <div class="am-modal-hd">说明</div>
	    <div class="am-modal-bd">
	      <ul class="am-list am-list-border am-text-justify"  style="margin-bottom: -3px;">
			  <li>1.凡参加省级<small>（含）</small>以上专业竞赛，获得省级二等奖及以上、国家级三等奖及以上、参加厅级<small>（含）</small>以上项目<small>（本人参与项目内容需与毕业设计或毕业论文一致）</small>、公开发表专业学术论文<small>（限前2名，内容需与毕业设计或毕业论文一致）</small>的学生，可申请免答辩。</li>
			  <li>2.申请表中“申请理由”部分由学生本人如实填写，还需向指导老师提供相关佐证材料原件和复印件<small>（获奖证书、期刊、项目结项证书等，原件核实后退回）</small>。</li>
			  <li>3.指导教师会对“申请理由”进行认定、签名。</li>
			  <li>4.学位委员会根据指导教师意见给出“同意”或“不同意”意见。</li>
			  <li>5.最终申请结果可以在查看信息处查看</li>
		  </ul>
	    </div>
	    <div class="am-modal-footer">
	      <span class="am-modal-btn">确定</span>
	    </div>
	  </div>
	</div>

<script src="../js/jquery.min.js"></script>
<script src="../amazeui/js/amazeui.min.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript">
	$(function() {
		
		//打开免答辩提示弹窗
		$('#my-alert').modal({
			'closeViaDimmer':false,
		});
		$('#my-alert').modal('open');
		
		
		$.ajax({
			   url: "/graduation/studentController/getStuAndProjectAndTeacher",
			   type: 'get',
			   dataType:'json',
			   async:false,
			   success: function(data){
				   if(!isNull(data.studentId)){
					   $('#tr1').find('td').eq(1).text(data.user.userAccount);
					   $('#tr1').find('td').eq(3).text(data.user.userName);
					   var gender;
					   if(data.user.userGender==1){
						   gender='男';
					   }else{
						   gender='女';
					   }
					   $('#tr1').find('td').eq(5).text(gender);
					   $('#tr2').find('td').eq(1).text(data.classInfo.subject.subjectName);
					   $('#tr2').find('td').eq(3).text(data.classInfo.grade.gradeName);
					   $('#tr2').find('td').eq(5).text(data.classInfo.className);
					   $('#tr3').find('td').eq(3).text(data.user.userTel);
					   $('#tr4').find('td').eq(1).text(data.project.projectName);
					   $('#tr4').find('td').eq(3).text(data.teacher.user.userName);
					   $('#mdb_btn').append($('<input>').attr({'type':'hidden','name':'studentId'}).val(data.studentId));
					   disBtn(data.studentId);
				   }else{
					   	$('#mdb_btn').addClass('am-disabled').text('请先选择课题');
						$('#column1').attr('disabled','disabled'); 
				   }
			   }
			 });
		
		//查询数据库是否应该禁用提交按钮
		function disBtn(studentId) {
			if(!isNull(studentId)&&studentId!='undefined'){
				$.ajax({
					   url: "/graduation/mdbController/getMdbByStudentId?studentId="+studentId,
					   type: 'get',
					   dataType:'json',
					   async:false,
					   success: function(data){
						   if(!isNull(data.mdbStatus)){
								$('#mdb_btn').addClass('am-disabled').text('已审核');
								$('#column1').attr('disabled','disabled').text(data.column1);
							}else if(!isNull(data.mdbId)){
								$('#mdb_btn').text('更新');
								$('#column1').text(data.column1);
								$('#mdb_btn').append($('<input>').attr({'type':'hidden','name':'studentId'}).val(data.studentId));
								$('#mdb_btn').append($('<input>').attr({'type':'hidden','name':'mdbId'}).val(data.mdbId));
							}
					   }
					 });
			}
		}
		
		//提交免答辩
		$('#mdb_btn').click(function () {
			  var $btn = $(this);
			  var studentId=$btn.find('input:hidden[name=studentId]').val();
			  var mdbId=$btn.find('input:hidden[name=mdbId]').val();
			  var column1=$('#column1').val();
			  if(isNull(column1)||isNull(studentId)){
				  return;
			  }
			  $.post('/graduation/mdbController/insertSelective',{
				  mdbId:mdbId,
				  studentId:studentId,
				  column1:column1
			  },function(data){
				  if(data){
					  $btn.button('loading');
					    setTimeout(function(){
					    	disableBtn('mdb_btn','完成');
					  }, 3000);
				  }
			  });
			    
		});

	});
</script>
</body>

</html>